package com.jinxin.platform.cdfaceacs.service.impl;

import com.jinxin.platform.cdfaceacs.mapper.JurenAcsControlImageInfoMapper;
import com.jinxin.platform.cdfaceacs.pojo.domains.AcsControlImageInfoDO;
import com.jinxin.platform.cdfaceacs.service.AcsControlImageInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (AcsControlImageInfo)表服务实现类
 *
 * @author makejava
 * @since 2020-04-28 16:27:39
 */
@Service("acsControlImageInfoService")
public class AcsControlImageInfoServiceImpl implements AcsControlImageInfoService {
    @Resource
    private JurenAcsControlImageInfoMapper imageInfoMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param acsImageId 主键
     * @return 实例对象
     */
    @Override
    public AcsControlImageInfoDO queryById(String acsImageId) {
        return this.imageInfoMapper.queryById(acsImageId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<AcsControlImageInfoDO> queryAllByLimit(int offset, int limit) {
        return this.imageInfoMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param acsControlImageInfo 实例对象
     * @return 实例对象
     */
    @Override
    public AcsControlImageInfoDO insert(AcsControlImageInfoDO acsControlImageInfo) {
        this.imageInfoMapper.insert(acsControlImageInfo);
        return acsControlImageInfo;
    }

    /**
     * 修改数据
     *
     * @param acsControlImageInfo 实例对象
     * @return 实例对象
     */
    @Override
    public AcsControlImageInfoDO update(AcsControlImageInfoDO acsControlImageInfo) {
        this.imageInfoMapper.update(acsControlImageInfo);
        return this.queryById(acsControlImageInfo.getAcsImageId());
    }

    /**
     * 通过主键删除数据
     *
     * @param acsImageId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String acsImageId) {
        return this.imageInfoMapper.deleteById(acsImageId) > 0;
    }
}